#!/bin/sh
echo "---- PRE-INSTALL ----"
echo "APPNAME    = $APPNAME"
echo "APPROOT    = $APPROOT"
echo "APPVERSION = $APPVERSION"
echo "APPOWNER   = $APPOWNER"
echo "---- PRE-INSTALL ----"

# check if the perl lib exists
modules_ready='yes'
for mod in 'Term::ReadKey' 'Net::SSH::Expect' 'Net::SCP::Expect' 'Net::FTP' 'LWP'
do
	PERL=`which perl`
	if [ $? -ne 0 ]
	then
		echo ' * perl need be installed!'
		modules_ready='no'
	else
		$PERL -M$mod -e '' 2>/dev/null
		if [ $? -ne 0 ]
		then
			echo " * perl module $mod need be installed!"
			modules_ready='no'
		fi
	fi
done
if [ ${modules_ready} != 'yes' ]
then
	echo 'Please install perl modules first!'
	exit 1
fi

exit 0
